package com.sky.mapper;

import com.sky.entity.DishFlavor;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : [caohailong]
 * @version : [v1.0]
 * @Description : 菜品套餐
 * @date : [2023/12/11 15:47]
 */
@Mapper
public interface SetmealDishMapper {

    /**
     * 查询菜品关联套餐信息
     * @param ids 菜品id
     */
    List<Long> getSetmealDishByIds(@Param("ids") List<Long> ids);

    /**
     * 批量保存套餐和菜品的关联关系
     * @param setmealDishes  菜品关联套餐信息
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id删除套餐和菜品的关联关系
     * @param setmealId 套餐id
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据套餐id查询套餐和菜品的关联关系
     * @param setmealId 套餐id
     * @return 套餐和菜品关联信息
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);
}
